<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>销售模块-销售产品</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="${s.base}/js/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="${s.base}/css/base/base.css" media="all" /></head>
	<style type="text/css">
		.head{width: 100%; height: 280px;}
		.head .head-left{width: 20%; height: 280px; float: left;}
		.head .head-left img{width: 98%; height:auto; max-height: 280px; margin: 0px 2%;}
		.head .head-right{width:80%; height: 280px; float: left;}
		.head .head-right .head-right-item{width:96%; height: 40px; line-height: 40px; margin: 0px 2%;}
		.content{width: 100%;}
	</style>
<body class="childrenBody">
<form class="layui-form" action="">
	<div class="head">
		<div class="head-left">
			<img src="${saleProduct.thumImage}">
		</div>
		<div class="head-right">
			<div class="head-right-item">
				${saleProduct.name}
			</div>
			<div class="head-right-item">
				所属分类:<span id="colId"></span>
			</div>
			<div class="head-right-item">
				版本:${saleProduct.versionNum}
			</div>
			<div class="head-right-item">
				<div class="layui-row">
					套餐类型:
					<input type="radio" name="priceType" value="1" title="${saleProduct.price}元/${saleProduct.useDay}天试用期套餐" checked="">
					<input type="radio" name="priceType" value="2" title="${saleProduct.oneYearPrice}元/一年套餐">
					<input type="radio" name="priceType" value="3" title="${saleProduct.twoYearPrice}元/两年套餐">
					<input type="radio" name="priceType" value="4" title="${saleProduct.threeYearPrice}元/三年套餐">
			</div>
			</div>
			<div class="head-right-item">
			</div>
			<div class="head-right-item">
				<div class="layui-row">
					<input type="button" id="buyBtn" class="layui-btn layui-btn-danger" value="立即创建"/>
					<button type="button" onclick="history.back();" class="layui-btn layui-btn-primary">返回</button>
				</div>

			</div>
		</div>
		<div style="clear: both;"></div>
	</div>
	<div class="content">
		<div class="layui-tab layui-tab-card">
			<ul class="layui-tab-title">
				<li class="layui-this">介绍详情</li>
				<li>更新记录</li>
			</ul>
			<div class="layui-tab-content" style="min-height: 500px;">
				<div class="layui-tab-item layui-show">${saleProduct.content}</div>
				<div class="layui-tab-item">${saleProduct.versionRecord}</div>
			</div>
		</div>

	</div>
</form>
<script type="text/javascript" src="${s.base}/js/layui/layui.js"></script>
<script type="text/javascript" src="${s.base}/js/base/base.js"></script>
<script type="text/javascript">layui.use(['jquery', 'element','pageUtil','baseUtil','dialogUtil','form'],
    function() {
    	var id='${saleProduct.id}';
        var $ = layui.jquery,
            form = layui.form,
            element = layui.element,
            baseUtil = layui.baseUtil,
            dialogUtil = layui.dialogUtil,
            pageUtil = layui.pageUtil;
        pageUtil.initDictByUrl("/saleColumn/acceptSelect","sale_column_type",function (dictDataUrl) {
           $("#colId").html(pageUtil.aceeptDictContentName(dictDataUrl, "sale_column_type",'${saleProduct.colId}'));
        });
        $("#buyBtn").bind("click",function () {
            var priceType=$('input[name="priceType"]:checked ').val();
            var priceTypeTitle=$('input[name="priceType"]:checked ').attr("title");
            dialogUtil.confirmTitleMessage("购买确认","您确定购买该产品["+priceTypeTitle+"]套餐吗？",function () {
                baseUtil.postMethod("/saleProduct/createProduct",{"id":id,"priceType":priceType},function (result) {
                    if (result.code === 0) {
                        //操作成功
                        dialogUtil.alert("购买成功！");
                    } else {
                        //操作失败
                        dialogUtil.alert(result.msg);
                    }

                });
            });
        })

    })</script>
</body>

</html>